<template>
  <div class="home">
    <div class="formtable">
      <el-table
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
        tooltip-effect="dark"
        :data="tableData"
        style="width: 100%"
      >
        <el-table-column prop="knowledgeName" label="知识库名称" width="400">
        </el-table-column>
        <el-table-column prop="creatorName" label="创建人" width="180"> </el-table-column>
        <el-table-column prop="knowledgeDesc" label="知识库简介"> </el-table-column>
        <el-table-column fixed="right" label="操作" width="200">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small" icon="el-icon-view">查看</el-button>
            <!-- <el-button @click="deleteClick(scope.row)" type="text" size="small" icon="el-icon-delete">删除</el-button> -->
            <!-- <el-button type="text" size="small" icon="el-icon-plus">新增</el-button> -->
          </template>
        </el-table-column>
      </el-table>
      <!-- <el-pagination background layout="prev, pager, next" :total="1000"> </el-pagination> -->
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData: [],
    };
  },
  computed: {},

  mounted() {},
  created() {
    this.getknowlist();
  },
  methods: {
    handleCommand(command) {
      this.$api.post("/corp/admin/logout", {}).then((res) => {
        this.$router.push({ name: "login" });
      });
    },
    getknowlist() {
      let that = this;
      that.$api.post("/knowledge/list", {}).then((res) => {
        that.tableData = res;
      });
    },
    handleClick(row) {
      this.$router.push({name:'Chat',params:{id:row.id}})
    },
    // deleteClick(row) {
    //   console.log(row)
    //   // this.$router.push({name:'Chat',params:{id:row.id}})
    // },
  },
};
</script>
<style lang="stylus" scoped>
.home
  background #fff
  min-height calc(100vh - 0px)
  >>>.el-icon-arrow-down
    margin-left 5px
    cursor pointer
  .formtable
    padding 20px
    display flex
    justify-content center
</style>
